package com.fangfaze.java.hcwork.liveLifeCycle.entity;

import lombok.Data;

import java.util.Date;

@Data
public class NetworkResult<T> {

    String code;
    String message;
    long timeStamp;
    T data;

    public static class Factory {
        public static <T> NetworkResult<T> success() {
            NetworkResult<T> networkResult = new NetworkResult<>();
            networkResult.setCode("200");
            networkResult.setMessage("成功");
            return networkResult;
        }

        public static <T> NetworkResult<T> success(T data) {
            NetworkResult<T> networkResult = new NetworkResult<>();
            networkResult.setCode("200");
            networkResult.setMessage("成功");
            networkResult.setData(data);
            return networkResult;
        }

        public static <T> NetworkResult<T> fail(String code, String message) {
            NetworkResult<T> networkResult = new NetworkResult<>();
            networkResult.setCode(code);
            networkResult.setMessage(message);
            return networkResult;
        }
    }

}

